function GetOS()
	return IsWindowsClient() and "Windows" or ( IsLinuxClient() and "Linux" ) or ( IsMacClient() and "MacOS" ) or "Unknown OS"
end

function string:split(sep)
	local sep, fields = sep or ":", {}
	local pattern = string.format("([^%s]+)", sep)
	self:gsub(pattern, function(c) fields[#fields+1] = c end)
	return fields
end

function table.getn(tbl,i)
	if i then
		return #tbl
	end
	local indexCount = 0
	table.foreach(tbl, function() indexCount = indexCount + 1 end)
	return indexCount
end

ClassFrame = {
	[0]  = {0,1,0,1},
	[1]  = {0,0.25,0,0.25},
	[2]  = {0,0.25,0.75,1},
	[3]  = {0,0.25,0.5,0.75},
	[4]  = {0.5, 0.75, 0, 0.25},
	[5]  = {0.5,0.75,0.5,0.75},
	[6]  = {0.25,0.5,0.75,1},
	[7]  = {0.25,0.5,0.5,0.75},
	[8]  = {0.25,0.5,0,0.25},
	[9]  = {0.75,1,0.75,1},
	[10] = {0.5,0.75,0,5,0.75},
	[11] = {0.75,1,0,0.25},
}

function UnitPortraitCoord(unit)
	local unitClassIndex = select(3,UnitClass(unit))
	return unpack(#ClassFrame[unitClassIndex] == 0 and {0.5, 0.75, 0, 0.25} or ClassFrame[unitClassIndex])
end